--- @param extension Package
--- @param HY HY_Utility
--- @param U Utility
return function(extension, HY, U)
    local hy_yorigami_jyoon = General:new(extension, "hy_yorigami_jyoon", "chi_k", 3, 3, General.Female)
    local seize_possession = fk.CreateSkill {
        name = "seize_possession",
    }
    seize_possession:addEffect(fk.Damaged, {
        anim_type = "negative",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(seize_possession.name) and player:inMyAttackRange(target) and data.card and data.card.trueName == "slash" and not target.dead
        end,
        on_cost = function(self, event, target, player, data)
            return player.room:askToSkillInvoke(player, {
                skill_name = seize_possession.name,
                prompt = "seize_possession_prompt::" .. target.id
            })
        end,
        on_use = function(self, event, target, player, data)
            local room = player.room
            room:drawCards(target, 2, seize_possession.name)
            local ids = room:askToCards(target, {
                min_num = 1,
                max_num = 1,
                skill_name = seize_possession.name,
                prompt = "seize_possession_prompt_choice::" .. player.id
            })
            if type(ids) == "number" then
                ids = { ids }
            end
            if #ids == 0 then
                if #target.player_cards[Player.Hand] <= 2 then
                    room:throwCard(target.player_cards[Player.Hand], seize_possession.name, target, target)
                else
                    room:askToDiscard(target, {
                        min_num = 2,
                        max_num = 2,
                        skill_name = seize_possession.name,
                        cancelable = false
                    })
                end
            else
                room:moveCardTo(Fk:getCardById(ids[1]), Card.PlayerHand, player, fk.ReasonGive, seize_possession.name)
            end
        end,
    })
    local extremely_violent = fk.CreateSkill {
        name = "extremely_violent",
        tags = {
            Skill.Quest
        },
    }
    extremely_violent:addEffect(fk.Damaged, {
        anim_type = "masochism",
        can_trigger = function(self, event, target, player, data)
            if player:getQuestSkillState("extremely_violent") then
                return false
            end
            return player:hasSkill(extremely_violent.name) and target == player and data.from and not target.dead and data.from ~= player
        end,
        on_trigger = function(self, event, target, player, data)
            event:setSkillData(self, "cancel_cost", false)
            for i = 1, data.damage do
                if data.from:isNude() or event:getSkillData(self, "cancel_cost") then
                    break
                end
                self:doCost(event, target, player, data)
            end
        end,
        on_cost = function(self, event, target, player, data)
            if player.room:askToSkillInvoke(player, {
                    skill_name = extremely_violent.name,
                    prompt = "extremely_violent_prompt:" .. data.from.id
                }) then
                return true
            else
                event:setSkillData(self, "cancel_cost", true)
            end
        end,
        on_use = function(self, event, target, player, data)
            local room = player.room
            local cardId = room:askToChooseCard(player, {
                target = data.from,
                flag = "he",
                skill_name = extremely_violent.name
            })
            room:obtainCard(player, cardId, false, fk.ReasonPrey)
        end
    })
    extremely_violent:addEffect(fk.EventPhaseStart, {
        can_trigger = function(self, event, target, player)
            if player:getQuestSkillState("extremely_violent") then
                return false
            end
            for _, t in ipairs(player.room:getOtherPlayers(player)) do
                if #t.player_cards[Player.Hand] > #player.player_cards[Player.Hand] then
                    return false
                end
            end
            return player:hasSkill("extremely_violent") and player.room:getBanner("RoundCount") > 1 and player.room.current == player and player.phase == Player.Start
        end,
        on_cost = Util.TrueFunc,
        on_use = function(self, event, target, player)
            player.room:notifySkillInvoked(player, "extremely_violent")
            player.room:updateQuestSkillState(player, "extremely_violent")
            player.room:handleAddLoseSkills(player, "-seize_possession|squander", nil,
                true, false)
        end
    })
    extremely_violent:addEffect(fk.EnterDying, {
        anim_type = "negative",
        can_trigger = function(self, event, target, player)
            if player:getQuestSkillState("extremely_violent") then
                return false
            end
            return player:hasSkill("extremely_violent") and target == player
        end,
        on_cost = Util.TrueFunc,
        on_use = function(self, event, target, player)
            player.room:notifySkillInvoked(player, "extremely_violent", "negative")
            player.room:updateQuestSkillState(player, "extremely_violent", true)
            local room = player.room
            local hp = player.hp
            if player:isWounded() then
                room:recover({
                    who = player,
                    num = 1 - hp,
                    recoverBy = player,
                    skillName = extremely_violent.name,
                })
            end
            local targets = room:askToChoosePlayers(player, {
                targets = room:getOtherPlayers(player),
                min_num = 1,
                max_num = 2,
                prompt = "extremely_violent_fail_prompt",
                skill_name = extremely_violent.name,
                cancelable = false
            })
            for _, p in ipairs(targets) do
                room:loseHp(p, 1, extremely_violent.name)
            end
        end
    })
    local squander = fk.CreateSkill {
        name = "squander",
    }
    squander:addEffect("active", {
        anim_type = "control",
        card_filter = Util.FalseFunc,
        target_num = 2,
        target_filter = function(self, player, to_select, selected, selected_cards)
            if #selected == 0 then
                return not to_select:isKongcheng()
            elseif #selected == 1 then
                return to_select.hp ~= selected[1].hp
            end
            return false
        end,
        can_use = function(self, player)
            return player:usedSkillTimes(squander.name, Player.HistoryPhase) == 0
        end,
        prompt = function(self, player, selected_cards, selected_targets)
            return "squander_prompt"
        end,
        target_tip = function(self, player, to_select, selected, selected_cards, card, selectable, extra_data)
            if #selected == 2 then
                local room = Fk:currentRoom()
                if selected[1].hp > selected[2].hp then
                    if to_select == selected[1] then
                        return "squander_loseCard"
                    elseif to_select == selected[2] then
                        return "squander_gainCard"
                    end
                else
                    if to_select == selected[2] then
                        return "squander_loseCard"
                    elseif to_select == selected[1] then
                        return "squander_gainCard"
                    end
                end
            end
        end,
        on_use = function(self, room, skillUseEvent)
            local target1 = skillUseEvent.tos[1]
            local target2 = skillUseEvent.tos[2]
            if target1.hp < target2.hp then
                target1, target2 = target2, target1
            end
            local player = skillUseEvent.from
            for i = 1, 2, 1 do
                if target1:isKongcheng() then
                    break
                end
                local cardId = room:askToChooseCard(player, {
                    target = target1,
                    flag = "h",
                    skill_name = squander.name
                })
                room:moveCards({
                    ids = { cardId },
                    from = target1,
                    toArea = Card.PlayerHand,
                    to = target2,
                    moveReason = fk.ReasonGive,
                    proposer = player,
                    skillName = squander.name,
                })
            end
        end
    })
    squander:addEffect("maxcards", {
        fixed_func = function(self, player)
            if player:hasSkill(squander.name) then
                return 5
            end
        end,
    })
    extension:loadSkillSkels { seize_possession, extremely_violent, squander }
    hy_yorigami_jyoon:addSkills { "seize_possession", "extremely_violent" }
    hy_yorigami_jyoon:addRelatedSkill("squander")
    Fk:loadTranslationTable {
        ["hy_yorigami_jyoon"] = "依神女苑",
        ["#hy_yorigami_jyoon"] = "巧言令色的暴戾",
        ["illustrator:hy_yorigami_jyoon"] = "りひと",
        ["designer:hy_yorigami_jyoon"] = "黑曜人形",
        ["cv:hy_yorigami_jyoon"] = "",

        ["seize_possession"] = "疫病",
        [":seize_possession"] = "你攻击范围内的角色受到【杀】造成的伤害后，你可以令其摸两张牌并选择一项：1.交给你一张手牌；2.弃置两张手牌。",
        ["seize_possession_prompt"] = "疫病：你可以令%dest摸两张牌",
        ["seize_possession_prompt_choice"] = "疫病：交给%dest一张手牌",

        ["extremely_violent"] = "极凶",
        [":extremely_violent"] = "使命技，在你受到1点伤害后，你可以获得伤害来源的一张牌。<br>&nbsp;&nbsp;&nbsp;&nbsp;成功：准备阶段，若你为场上手牌最多的角色且此轮不是首轮，你失去“疫病”，获得“<a href = ':squander'>散财</a>”。<br>&nbsp;&nbsp;&nbsp;&nbsp;失败：当你进入濒死状态时，你将体力回复至1点，然后令一至两名其他角色失去1点体力。",
        ["#extremely_violent_success"] = "极凶",
        ["#extremely_violent_fail"] = "极凶",
        ["#extremely_violent_trigger"] = "极凶",
        ["extremely_violent_prompt"] = "极凶：你可以获得%src一张牌",
        ["extremely_violent_fail_prompt"] = "极凶：令一至两名其他角色失去1点体力",

        ["squander"] = "散财",
        [":squander"] = "出牌阶段限一次，你选择一名有手牌的角色与一名体力值少于其的角色，依次将前者的两张手牌交给后者。你的手牌上限为5。",
        ["squander_prompt"] = "散财：将体力值多的角色的手牌交给体力值少的角色",
        ["squander_loseCard"] = "被获得牌",
        ["squander_gainCard"] = "获得牌",
    }
end
